setClass("VBootstrapedSet",
		representation(
				.bSetRepresentation="matrix",#matix contains bootstrap scheme matrix
				.bSamplesNumber="numeric",   #number of bootstraped samples
				.currentSet="list",
				.originalSet="list",
				.description="character",
				.areClassesPresent="logical",
				"VIRTUAL"
					),
		prototype=prototype(
				.bSetRepresentation=matrix(),
				.bSamplesNumber=1,
				.currentSetNumber=0,
				.currentSet=list(),
				.originalSet=list(),
				.description="Virtual bootstrap Class",
				.areClassesPresent=FALSE
				),
		validity=function(.Object){
			if( .Object@.bSamplesNumber <=0 ){
				stop("Number of samples must be positive")
			}
			
			if(is.null(.Object@.originalSet$X)){
				stop("input Set does not contain X element ")
			}
			
			if(! is.matrix(.Object@.originalSet$X)){
				stop("X element of input set is not matrix")
			}
			
			if((.Object@.areClassesPresent)){
				if( !is.numeric( .Object@.originalSet$Y ) ){
					stop("Y element of input set is not numeric")
				}
				
			}
		}
					
)
#generics
setGeneric("getSamplesNumber",function(.Object,...){standardGeneric("getSamplesNumber")})
setGeneric("getAt",function(.Object,position,...){standardGeneric("getAt")})
setGeneric("changeSet",function(.Object,inputSet,...){standardGeneric("changeSet")})

#methods

#initialization method
#INPUT:
#	inputSet: list contains set to bootstrap
#				inputSet$X  matrix:  rows - probes, columns - attributes
#				inputSet$Y	numeric vector of classes
setMethod("initialize",
		signature="VBootstrapedSet",
		definition=function(.Object,inputSet=list(X=matrix(),Y=numeric(0)),bSamplesNumber=1,...){
			#initialize fields
			.Object@.bSamplesNumber <- bSamplesNumber #number of generated samples
			.Object@.originalSet <- inputSet
			.Object@.areClassesPresent <-!is.null(inputSet$Y)
			
			validObject(.Object)
			return(.Object)
		})

setMethod("changeSet",
		signature="VBootstrapedSet",
		definition=function(.Object,inputSet,...){
			.Object<-initialize(.Object,inputSet=inputSet,bSamplesNumber=.Object@.bSamplesNumber,...)
			
			
			return(.Object)
		})

setMethod("get_description",
		signature="VBootstrapedSet",
		definition=function(.Object){
			.Object@.description
		})

setMethod("getSamplesNumber",
		signature="VBootstrapedSet",
		definition=function(.Object){
			.Object@.bSamplesNumber
		})

